function selectDeptTree() {
    var treeId = $("#treeId").val();
    var deptId = $.common.isEmpty(treeId) ? "100" : $("#treeId").val();
    var url = ctx + "base/sys/dept/selectDeptTree/" + deptId;
    var options = {
        title: '选择部门',
        width: "380",
        url: url,
        callBack: doSubmit
    };
    $.modal.openOptions(options);
}

function doSubmit(index, layero){
    var tree = layero.find("iframe")[0].contentWindow.$._tree;
    var body = $.modal.getChildFrame(index);
    var treeId = body.find('#treeId').val();
    if(treeId==100) {
        $("#treeId").val(null);
        $("#treeName").val("");
        $("#treeCode").val("");
    } else {
        $("#treeId").val(body.find('#treeId').val());
        $("#treeName").val(body.find('#treeName').val());
        $("#treeCode").val(body.find('#treeCode').val());
    }
    $.modal.close(index);
}